home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 76 / XENIATGM66.iso / Indiana Jones / Indiana Jones.exe / RESOURCE / PREVIEW.GOB / cog_shw_portculliswheel.cog < prev    next >
Text File  |  1999-11-15  |  14KB  |  528 lines

  1. # Jones 3D Cog Script
  2. #
  3. # Portcullis_wheel.cog
  4. #
  5. # Sluiceway Alternating Script
  6. #
  7. # [CMG]
  8. #
  9. # (C) 1997 LucasArts Entertainment Co. All Rights Reserved
  10. # ========================================================================================
  11.  
  12. symbols
  13.     
  14.                 
  15.         message    startup    
  16.         message    activated    
  17.         message user0        
  18.         message user1
  19.         message pulse
  20.         
  21.     #    cogs
  22.         cog        camcog
  23.     
  24.     #    props
  25.         thing    wheel
  26.         thing    gate0
  27.         thing    gate1
  28.         thing    lever
  29.         thing    grill0
  30.         thing    grill1
  31.         thing    splashitem    local
  32.         thing    splashspot    
  33.         
  34.  
  35.     #    water objects
  36.         thing    channelH2Opos    
  37.         thing    sluiceH2Opos    
  38.         thing    channelwateritem    
  39.         thing    sluicewateritem    
  40.     
  41.     #    actors    
  42.         thing    player        local
  43.         thing    indy        
  44.     
  45.     #    cameras
  46.         thing    camera    
  47.         thing    portculliscam2
  48.         thing    portculliscam3
  49.     
  50.     #    camera targets
  51.         thing    grilltarget0
  52.         thing    grilltarget1
  53.         thing    camtarget
  54.     
  55.     #    water sectors
  56.         sector  sluice0
  57.         sector  sluice1
  58.         sector  sluice2
  59.         
  60.         sector  wheelchan0
  61.         sector  wheelchan1
  62.         sector  wheelchan2
  63.         
  64.     #    water faces
  65.         surface sluicesurf0
  66.         surface sluicesurf1
  67.         surface sluicesurf2
  68.         surface sluicesurf3
  69.         surface sluicesurf4
  70.         surface sluicesurf5
  71.         surface sluicesurf6
  72.         surface sluicesurf7
  73.         surface sluicesurf8
  74.         surface sluicesurf9
  75.         
  76.         surface chansurf0
  77.         surface chansurf1
  78.         surface chansurf2
  79.         surface chansurf3
  80.         surface chansurf4
  81.         surface chansurf5
  82.         
  83.         vector  sect_light      local
  84.     
  85.     #    templates
  86.         template    splash=TitanicH2Ofx    local
  87.         
  88.     
  89.     #    keyframes
  90.         keyframe    in_pull=in_pull_lever_down.key            local
  91.         keyframe    lever_down=gen_lever.key        local
  92.         keyframe    gate_close=shw_gate_pvta.key        local
  93.         keyframe    gate_open=shw_gate_pvtb.key        local
  94.         keyframe    wheel_run=shw_wheel_prtcls.key        local
  95.         
  96.         flex    FOV=90
  97.         int         curCam            local
  98.         int     thaw=0            local
  99.         int     spin            local
  100.         int     index            local
  101.         int     gate0_run        local
  102.         int     gate1_run        local
  103.         int     position=0        local
  104.         int     gatesup=0        local
  105.         int        gatetrack        local
  106.         int        rushtrack        local
  107.  
  108.         sound   leverpull=nub_lever_pull_c.wav          local
  109.         sound   leverset=nub_lever_reset_c.wav          local
  110.         sound   gatestart=shw_sluice_start.wav          local
  111.         sound   gaterun=shw_sluice_move.wav          local
  112.         sound   gatestop=shw_sluice_stop.wav          local
  113.         sound   waterrush=nub_bull_move2_c.wav          local
  114. end
  115.  
  116. # ========================================================================================
  117.  
  118. code
  119.  
  120. startup:
  121.  
  122.         player = GetLocalPlayerThing();
  123.         SetThingFlags(channelwateritem, 0x10);
  124.         SetThingFlags(sluicewateritem, 0x10);
  125.         
  126.          //clearing channel
  127.     
  128.           sect_light = VectorSet(0.0, 0.0, 0.0);
  129.         for (index = 0; index < 3; index = index + 1)
  130.             {
  131.         Setsectorlight(wheelchan0[index], sect_light, 3);
  132.                 clearsectorflags(wheelchan0[index], 0x2);
  133.                 }
  134.        
  135.         for (index = 0; index < 6; index = index + 1)
  136.             {
  137.         Setfacegeomode(chansurf0[index], 0);
  138.                 }
  139.         
  140.         //clearing sluice
  141.     
  142.         sect_light = VectorSet(0.0, 0.0, 0.0);
  143.         for (index = 0; index < 3; index = index + 1)
  144.         {
  145.                 Setsectorlight(sluice0[index], sect_light, 3);
  146.         clearsectorflags(sluice0[index], 0x2);
  147.                 }
  148.  
  149.         for (index = 0; index < 10; index = index + 1)
  150.             {
  151.         Setfacegeomode(sluicesurf0[index], 0);
  152.                 }
  153.         return;
  154.  
  155.  
  156. # ........................................................................................
  157.  
  158. activated:
  159.  
  160.     if (position == 0)
  161.     {
  162.     
  163.         if (isMoving(gate0)) return;
  164.         if (GetSenderRef() == lever)
  165.                {
  166.                 # Remember the current camera
  167.                 curCam = GetCurrentCamera();
  168.                 
  169. # Disable and hide player
  170.                 SetThingFlags(player, 0x80000);
  171.  
  172. # Cut to cutscene camera
  173.                 SetCameraFocus(2, camera);
  174.                 SetCamerasecondaryFocus(2, camtarget);
  175.                 SendMessage(camcog, user0);
  176.                 #SetCurrentCamera(2);
  177.                 ClearThingFlags(indy, 0x80000);
  178.                 position = 1;
  179.                 
  180. # Play the Indy and lever animations and sounds
  181.                 PlayKey(lever, lever_down, 4, 0x12, 0);
  182.                 PlayKey(indy, in_pull, 4, 0x12, 0);
  183.                 Sleep(1.0);
  184.                 PlaySoundLocal(leverpull, 1.0, 0, 0x0, 0);
  185.                 Sleep(1.25);
  186.                 PlaySoundLocal(leverset, 0.75, 0, 0x0, 0);
  187.                 Sleep(1.0);
  188.                 
  189. # move camtarget and camera over the wheel
  190.                 MovetoFrame(camera, 1, 1);
  191.                 MovetoFrame(camtarget, 1, 2);
  192.                 waitforstop(camera);
  193.                 Sleep(.5);
  194.  
  195. # sounds an animations for the gates closing
  196.                 PlaySoundLocal(gatestart, 6, 0, 0x0, 0);
  197. # pulse for screenshake                
  198.                 SetPulse(.1);
  199.                 Sleep(.25);
  200.                 gatetrack = PlaySoundThing(gaterun, gate0, 5.0, 0, 20, 1);
  201.                 
  202.                 # MOVE THE SLUICE GATES
  203.                 Rotate(gate1, 60, 1, 1);
  204.                 Rotate(gate0, -60, 1, 1);
  205.                 Sleep(.25);
  206.  
  207.                         If (thaw == 1)
  208.                                 {
  209.                                 rushtrack = PlaySoundThing(waterrush, wheel,  8.0, 0, 20, 1);
  210.                                 call moses;
  211.                                 }
  212.                 
  213.                 Sleep(1.0);
  214.                 StopSound(gatetrack, 0.0);
  215.                 PlaySoundLocal(gatestop, 4, 0, 0x0, 0);
  216.  
  217.                 Call spincheck;
  218.                 Sleep(1.0);
  219.                 
  220.                 
  221.                 #    return player control
  222.                 SetThingFlags(indy, 0x80000);
  223.                 ClearThingFlags(player, 0x80000);
  224.                 #SetCurrentCamera(curCam);
  225.                 SetPulse(0);
  226.                 SendMessage(camcog, user1);
  227.                 movetoframe(camera, 0, 50);
  228.                 movetoframe(camtarget, 0, 50);
  229.                 }
  230.     }
  231.  
  232. if (position == 1)
  233.     {
  234.     
  235.         if (isMoving(gate0)) return;
  236.         if (GetSenderRef() == lever)
  237.                {
  238.                 # Remember the current camera
  239.                 curCam = GetCurrentCamera();
  240.                 
  241. # Disable and hide player
  242.                 SetThingFlags(player, 0x80000);
  243.  
  244. # Cut to cutscene camera
  245.                 SetCameraFocus(2, camera);
  246.                 SetCamerasecondaryFocus(2, camtarget);
  247.                 SendMessage(camcog, user0);
  248.                 #SetCurrentCamera(2);
  249.                 ClearThingFlags(indy, 0x80000);
  250.                 position = 0;
  251.                 
  252. # Play the Indy and lever animations and sounds
  253.                 PlayKey(lever, lever_down, 4, 0x12, 0);
  254.                 PlayKey(indy, in_pull, 4, 0x12, 0);
  255.                 Sleep(1.0);
  256.                 PlaySoundLocal(leverpull, 1.0, 0, 0x0, 0);
  257.                 Sleep(1.25);
  258.                 PlaySoundLocal(leverset, 0.75, 0, 0x0, 0);
  259.                 Sleep(1.0);
  260.                 
  261. # move camtarget and camera over the wheel
  262.                 MovetoFrame(camera, 1, 1);
  263.                 MovetoFrame(camtarget, 1, 2);
  264.                 waitforstop(camera);
  265.                 Sleep(.5);
  266.  
  267. # sounds an animations for the gates closing
  268.                 PlaySoundLocal(gatestart, 6, 0, 0x0, 0);
  269. # pulse for screenshake                
  270.                 SetPulse(.1);
  271.                 Sleep(.25);
  272.                 gatetrack = PlaySoundThing(gaterun, gate0, 5.0, 0, 20, 1);
  273.                 
  274.                 # MOVE THE SLUICE GATES
  275.                 Rotate(gate1, -60, 1, 1);
  276.                 Rotate(gate0, 60, 1, 1);
  277.                 Sleep(.25);
  278.  
  279.                         If (thaw == 1)
  280.                                 {
  281.                                 rushtrack = PlaySoundThing(waterrush, wheel,  8.0, 0, 20, 1);
  282.                                 call moses;
  283.                                 }
  284.                 
  285.                 Sleep(1.0);
  286.                 StopSound(gatetrack, 0.0);
  287.                 PlaySoundLocal(gatestop, 4, 0, 0x0, 0);
  288.  
  289.                 Call spincheck;
  290.                 Sleep(1.0);
  291.                 
  292.                 
  293.                 #    return player control
  294.                 SetThingFlags(indy, 0x80000);
  295.                 ClearThingFlags(player, 0x80000);
  296.                 #SetCurrentCamera(curCam);
  297.                 SetPulse(0);
  298.                 SendMessage(camcog, user1);
  299.                 movetoframe(camera, 0, 50);
  300.                 movetoframe(camtarget, 0, 50);
  301.                 }
  302.     }
  303.                 
  304.     return;
  305.  
  306. # ........................................................................................
  307.  
  308. blocked:
  309.     ##print("Blocked");
  310. //    ?????    
  311.     return;
  312.  
  313. # ........................................................................................
  314. spincheck:
  315.         
  316.         If ((position == 1) && (thaw == 1))        # correct position with water
  317.                 {
  318.                 ###print("keyframe should be playing now...");
  319.                 spin = PlayKey(wheel, wheel_run, 4, 0x0, 0);
  320.                 ###print("aahh...power to the facility...");
  321.                 Sleep(1.0);
  322.                 SetPulse(0);
  323.                 ###print("the pulse is cut");
  324.                 
  325.                     If (gatesup == 0)
  326.                     {
  327.                     #    Show the grills open
  328.                     SetCamerasecondaryFocus(2, grilltarget0);
  329.                     SetCameraFocus(2, portculliscam2);
  330.                     SetCurrentCamera(2);
  331.                     Movetoframe(grill0, 1, .75);
  332.                     Movetoframe(grill1, 1, .75);
  333.                     Sleep(2.0);
  334.                     SetCamerasecondaryFocus(2, grilltarget1);
  335.                     SetCameraFocus(2, portculliscam3);
  336.                     WaitForStop(grill1);
  337.                     gatesup = 1;
  338.                     Sleep(1.0);
  339.                     #    return player control
  340.                     SetThingFlags(indy, 0x80000);
  341.                     ClearThingFlags(player, 0x80000);
  342.                     SetCurrentCamera(curCam);
  343.                     return;
  344.                     }
  345.  
  346.  
  347.                 }
  348.                 
  349.         else If ((position == 1) && (thaw == 0))        # correct position no water
  350.                 {
  351.                 ####print("I need water power...");
  352.                 If (spin != -1)
  353.                 {
  354.                     StopKey(spin);
  355.                 }
  356.                 If (rushtrack != -1)
  357.                 {
  358.                     StopSound(rushtrack, 1.5);
  359.                 }
  360.                 SetPulse(0);
  361.                 
  362.                 }
  363.                 
  364.         else If ((position == 0) && (thaw == 0))        # wrong position no water
  365.                 {
  366.                 ##print("I need water power...");
  367.                 If (spin != -1)
  368.                 {
  369.                     StopKey(spin);
  370.                 }
  371.                 If (rushtrack != -1)
  372.                 {
  373.                     StopSound(rushtrack, 1.5);
  374.                 }
  375.                 SetPulse(0);
  376.                 
  377.                 }
  378.                 
  379. return;
  380.  
  381. # ........................................................................................
  382. moses:
  383.  
  384. If (position == 0)
  385.    {
  386.     
  387.     # prepare the water objects for movement
  388.     #print("POSITION IS 0");
  389.     #print("sluiceitem down");
  390.     Rotate(sluicewateritem, 90, 2, 0.01);           #exp angle
  391.     Sleep(.01);
  392.     ClearThingFlags(sluicewateritem, 0x10);
  393.     Rotate(sluicewateritem, -90, 2, 1.5);
  394.     #print("sluiceitem up");
  395.          
  396.     ClearThingFlags(channelwateritem, 0x10);
  397.        
  398.     
  399.        
  400.     //clearing channel
  401.     
  402.           sect_light = VectorSet(0.0, 0.0, 0.0);
  403.     for (index = 0; index < 3; index = index + 1)
  404.         {
  405.         Setsectorlight(wheelchan0[index], sect_light, 4);
  406.         clearsectorflags(wheelchan0[index], 0x2);
  407.         }
  408.        
  409.     for (index = 0; index < 6; index = index + 1)
  410.         {
  411.         Setfacegeomode(chansurf0[index], 0);
  412.         }
  413.  
  414.     Rotate(channelwateritem, -90, 2, 1.5);
  415.     #print("channelitem down");
  416.  
  417.     WaitForStop(sluicewateritem);
  418.     
  419.     
  420.     //setting sluice
  421.     
  422.         sect_light = VectorSet(0.0, 0.5, 1.0);
  423.     for (index = 0; index < 3; index = index + 1)
  424.         {
  425.         Setsectorlight(sluice0[index], sect_light, 4);
  426.         Setsectorflags(sluice0[index], 0x2);
  427.         }
  428.  
  429.     for (index = 0; index < 10; index = index + 1)
  430.         {
  431.         Setfacegeomode(sluicesurf0[index], 4);
  432.         }
  433.    
  434.         # reset sluicewateritem
  435.         SetThingFlags(sluicewateritem, 0x10);
  436.         CopyOrientAndPos(sluiceH2Opos, sluicewateritem); 
  437.         # reset channelwateritem
  438.         SetThingFlags(channelwateritem, 0x10);
  439.         CopyOrientAndPos(channelH2Opos, channelwateritem);
  440.    }
  441.  
  442.  
  443.         
  444. else If (position ==1)
  445.    {
  446.         
  447.        
  448.         # prepare the water objects for movement
  449.         Rotate(channelwateritem, -90, 2, 0.01);           #exp angle
  450.         #print("POSITION IS 1");
  451.         #print("channelitem down");
  452.         Sleep(.01);
  453.         ClearThingFlags(channelwateritem, 0x10);
  454.         Rotate(channelwateritem, 90, 2, 1.0);
  455.         #print("channelitem up");
  456.          
  457.         ClearThingFlags(sluicewateritem, 0x10);
  458.         
  459.         //clearing sluice
  460.     
  461.         sect_light = VectorSet(0.0, 0.0, 0.0);
  462.     
  463.         Setsectorlight(sluice1, sect_light, 4);
  464.         clearsectorflags(sluice1, 0x2);
  465.         Setfacegeomode(sluicesurf4, 0);
  466.         Setfacegeomode(sluicesurf5, 0);
  467.     
  468.         
  469.         
  470.         Rotate(sluicewateritem, 90, 2, 1.0);
  471.         #print("sluiceitem down");
  472.         
  473.         
  474.         WaitForStop(channelwateritem);
  475.  
  476.            //setting channel
  477.     
  478.           sect_light = VectorSet(0.0, 0.5, 1.0);
  479.     for (index = 0; index < 3; index = index + 1)
  480.         {
  481.         Setsectorlight(wheelchan0[index], sect_light, 4);
  482.         setsectorflags(wheelchan0[index], 0x2);
  483.         }
  484.        
  485.     for (index = 0; index < 6; index = index + 1)
  486.         {
  487.         Setfacegeomode(chansurf0[index], 4);
  488.         }
  489.     
  490.     
  491.         # reset sluicewateritem
  492.         SetThingFlags(sluicewateritem, 0x10);
  493.         CopyOrientAndPos(sluiceH2Opos, sluicewateritem); 
  494.         # reset channelwateritem
  495.         SetThingFlags(channelwateritem, 0x10);
  496.         CopyOrientAndPos(channelH2Opos, channelwateritem);
  497.         
  498.    }
  499. return;
  500.  
  501. # ........................................................................................
  502.  
  503. user0:
  504.         thaw = 0;
  505.         call startup;
  506.         return;
  507.         
  508. user1:
  509.         thaw = 1;
  510.         call moses;
  511.         call spincheck;
  512.         return;
  513.         
  514.  
  515. # ........................................................................................
  516. pulse:
  517.  
  518.     SetPOVShake('0.0 0.0 0.015', '0.0 0.0 0.015', 0.80, 80.0);
  519.         If (thaw == 1)
  520.         {
  521.         splashitem = CreateThing(splash, splashspot);
  522.         }
  523.  
  524.     return;
  525. # ........................................................................................
  526. end
  527.  
  528.